package com.robot.admin.client;

import com.robot.admin.client.impl.AgentClientImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.Map;

/**
 * @author wuyunbin
 */
@Component
@FeignClient(value = "robot-agent", fallback = AgentClientImpl.class)
public interface AgentClient {
    /**
     * 条件查询代理商
     *
     * @param searchMap
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "agent/third/findAgentsBySearch/{page}/{size}", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    public String thirdFindAgentsBySearch(@RequestBody Map searchMap, @PathVariable int page, @PathVariable int size);

    /**
     * 通过ID查询代理商
     *
     * @param id
     * @return
     */
    @RequestMapping(value = "agent/third/findAgentById/{id}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindAgentById(@PathVariable String id);

    /**
     * 通过phone查询代理商
     *
     * @param phone
     * @return
     */
    @RequestMapping(value = "agent/third/findAgentByPhone/{phone}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindAgentByPhone(@PathVariable String phone);

    /**
     * 通过areaId和status查询agent
     *
     * @param areaId
     * @param status
     * @return
     */
    @RequestMapping(value = "agent/third/findAgentByAreaIdAndStatusAndDeletedAtIsNull/{areaId}/{status}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindAgentByAreaIdAndStatusAndDeletedAtIsNull(@PathVariable String areaId, @PathVariable String status);

    /**
     * 新增代理商
     *
     * @param agent
     */
    @RequestMapping(value = "agent/third/addAgent", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    public void thirdAddAgent(@RequestBody String agent);

    /**
     * 修改代理商
     *
     * @param agent
     */
    @RequestMapping(value = "agent/third/updateAgent", method = RequestMethod.PUT, produces = "application/json; charset=utf-8")
    public void thirdUpdateAgent(@RequestBody String agent);

    /**
     * 硬删除代理商
     *
     * @param id
     */
    @RequestMapping(value = "agent/third/deleteAgentById/{id}", method = RequestMethod.DELETE, produces = "application/json; charset=utf-8")
    public void thirdDeleteAgentById(@PathVariable String id);
}
